package com.qmyx.supplychain.quartz.task;

import com.ytjj.qmyx.supplychain.service.OrderTimerService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.io.IOException;

@Slf4j
@Component
public class JuShuiTanTask {
    @Autowired
    private OrderTimerService orderTimerService;

    /**
     * 定时获取聚水潭订单发货信息，更新供应商订单表的物流信息
     * @throws IOException
     */
//    @Scheduled(cron = "0 0/30 * * * ?")
    public void queryJuShuiTanOrderInfo() throws IOException {
        log.info("============> 定时获取聚水潭订单信息开始");
        orderTimerService.queryJuShuiTanOrderInfo();
        log.info("============> 定时获取聚水潭订单信息结束");
    }

    /**
     * 定时向聚水潭推送发送失败订单信息
     */
//    @Scheduled(cron = "0 0/50 * * * ?")
    public void uploadOrderToJuShuiTan() {
        log.info("============> 定时向聚水潭推送失败订单信息开始");
        orderTimerService.uploadOrderToJuShuiTan();
        log.info("============> 定时向聚水潭推送失败订单信息结束");
    }

    /**
     * 定时向聚水潭推送售后订单信息
     */
//    @Scheduled(cron = "0 0/20 * * * ?")
    public void afterSaleOrderToJuShuitan() {
        log.info("============> 定时向聚水潭推送售后订单信息开始");
        orderTimerService.afterSaleOrderToJuShuitan();
        log.info("============> 定时向聚水潭推送售后订单信息结束");
    }
}
